use lib qw(.);

use MyPackage;

Log::Log4perl->init("log.conf");

my $mypack = new MyPackage;

$mypack->someMethod();

my $log = Log::Log4perl->get_logger("Foo.Bar");

$log->debug("Debug message");
$log->info("Info message");
$log->error("Error message");
newStyleLog();

sub newStyleLog
{
# Configuration in a string ...
    my $logFileName = "whq.log";
    my $conf = "";
    $conf .= "log4perl.category.Foo.Whq          = INFO, Logfile, Screen\n\n" ;
    $conf .= "log4perl.appender.Logfile          = Log::Log4perl::Appender::File\n" ;
    $conf .= "log4perl.appender.Logfile.filename = $logFileName\n" ;
    $conf .= "log4perl.appender.Logfile.layout   = Log::Log4perl::Layout::PatternLayout\n" ;
    $conf .= "log4perl.appender.Logfile.layout.ConversionPattern = [%r] %F %L %m%n\n\n" ;
    $conf .= "log4perl.appender.Screen         = Log::Log4perl::Appender::Screen\n" ;
    $conf .= "log4perl.appender.Screen.stderr  = 0\n" ;
    $conf .= "log4perl.appender.Screen.layout = Log::Log4perl::Layout::SimpleLayout\n" ;

# ... passed as a reference to init()
    Log::Log4perl::init( \$conf );
    my $log = Log::Log4perl->get_logger("Foo.Whq");
    $log->debug("Debug message");
    $log->info("Info message");
    $log->error("Error message");

}
